package com.zr.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.NewlyIincreasedStaffDao;
import com.zr.model.LMdistributionPerson;

/**
 * 配送点管理员管理配送点员工
 * @author wzp
 *
 * @param <LMdistributionPerson>
 */
@Repository(value="NStaffdao")
public class NewlyIincreasedStaffDaoImpl<LMdistributionPerson> extends BaseDaOImpl<LMdistributionPerson> implements NewlyIincreasedStaffDao<LMdistributionPerson> {

	@Override
	public List<LMdistributionPerson> findStaff(int rows, int start, int uid) {
		// TODO Auto-generated method stub
		StringBuffer hql = new StringBuffer("from l_mdistribution_person lp where lp.uid=:uid limit :start,:rows");
		Query query = this.getCurrentSession().createQuery(hql.toString());
		query.setInteger("uid", uid);
		query.setInteger("start", start);
		query.setInteger("rows", rows);
		List<LMdistributionPerson> lpList = query.list();
		return lpList;
	}

	@Override
	public int findNumStaff(int uid) {
		// TODO Auto-generated method stub
		StringBuffer hql = new StringBuffer("from l_mdistribution_person lp where lp.uid=:uid");
		Query query = this.getCurrentSession().createQuery(hql.toString());
		query.setInteger("uid", uid);
		int staffnum = query.list().size();
		return staffnum;
	}

}
